package com.mchat.communication.protocol;

import lombok.*;
import org.msgpack.annotation.Message;

@Getter
@Setter
@Message
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class IMMessage {
    private String address;
    private String action;
    private Long time;
    private Integer online;
    private String sender;
    private String avatar;
    private String receiver;
    private String content;

    public static IMMessage copyMessage(IMMessage message) {
        return IMMessage.builder()
                .action(message.getAction())
                .content(message.getContent())
                .sender(message.getSender())
                .time(message.getTime())
                .receiver(message.getReceiver())
                .address(message.getAddress())
                .avatar(message.getAvatar())
                .online(message.getOnline())
                .build();
    }
}